#ifndef __userModularFunctionBase__
#define __userModularFunctionBase__

#include <vector>
#include <string>
#include <iostream>
#include <online-certifier/util/typeDefines.hh>

using namespace std;

class userModularFunctionBase{
    public:
        userModularFunctionBase(vector<string>& args){arguments = args;}
        virtual ~userModularFunctionBase()=0;
        static userModularFunctionBase* initializeByName(string name);
        static userModularFunctionBase* initializeByName(string name, vector<string> args);
//        virtual void setArguments(vector<string>& args){ arguments = args;}
        virtual void userModularFunction(fixedBitSizeInteger prime)=0;


        virtual void* getPair(size_t index)=0; //used by the certifier
        virtual e_residueType getResidueType()=0; //should be used by frontend, certifier, decoder

        void setName(string n){name = n;}
        string getName(){return name;}

        vector<string>& getArguments(){ return arguments;} //used by frontendCommunicator
        vector< pair<int,string> >& getFiles(){ return files;} //used by frontendCommunicator
        
        friend std::ostream& operator<< (std::ostream& os,  userModularFunctionBase& b); //used by kaapiTask to serialize result

    protected:
        void setFile(int index);
        
        // a trick to override operator >> by subclasses
        virtual void write_to_ostream(ostream& os)=0; 
    private:
        vector<string> arguments;
        vector< pair<int,string> >  files;//file index, file fullname
        string name;

};

#endif
